package 原型和克隆;

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args) throws CloneNotSupportedException {
        Person zhangsan = new Person(2, "张三");
        zhangsan.getHots().add("aaa");
        System.out.println(zhangsan.toString());
        Person cloneObj = (Person) zhangsan.clone();
        cloneObj.getHots().add("bbbb");
        System.out.println(cloneObj.toString());
        // List已经实现了深克隆
        Object o = zhangsan.deepClone();
        System.out.println(o);
    }
}
